var pid;
window.onload =function (){
    //得到前一个页面的id
    pid=getQuery("id");
    findById();
}

/**
 * 按ID查询
 */
function findById(){
    axios.get("/product/findById",{
        params:{
            id:pid
        }
    }).then(resp=>{
        var info = resp.data;
        $("nameSpan").innerHTML=info.name;
        $("dateSpan").innerHTML=info.createDate;
        $("priceTxt").value = info.price;
    });
}
function update(){
    axios.get("/product/update",{
        params: {
            id:pid,
            price:$("priceTxt").value
        }
    }).then(resp =>{
        if(resp.data == "ok"){
            location.href = "/product/main.html";
        }
    })
}